<style type="text/css">
		label, input { display:block; }
		input.text { margin-bottom:12px; width:95%; padding: .4em; }
		fieldset { padding:0; border:0; margin-top:25px; }
		h1 { font-size: 1.2em; margin: .6em 0; }
		div#users-contain { width: 350px; margin: 20px 0; }
		div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; }
		div#users-contain table td, div#users-contain table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; }
		.ui-dialog .ui-state-error { padding: .3em; }
		.validateTips { border: 1px solid transparent; padding: 0.3em; }
		
	</style>

        <g:set var="entityName" value="${message(code: 'plan.label', default: 'Plan')}" />
             <g:form action="save" method="post" name="planCreate">
                <div class="dialog">
                    <table>
                        <tbody>
                            <tr class="prop"> 
                             <%
                                def groupByUnitTimeList = planList.groupBy{
                                    it.restTime.unitTime
                                }
                              %>
                              <td width="100px">上课时间</td>
                            <g:each in="${['一','二','三','四','五']}" status="i" var="weekInstance">
                                <td>周${weekInstance}</td>
                            </g:each>
                            </tr> 
                                    <%
                                        groupByUnitTimeList.each{
                                        %>            
                                        <tr>  
                                        <td>
                                        ${it.value[0].restTime.startHour}:
                                        ${it.value[0].restTime.startMinute}
                                        ~
                                        ${it.value[0].restTime.endHour}:
                                        ${it.value[0].restTime.endMinute}
                                        </td>
                                        <%
                                            it.value.each{elem ->                                                 
                                        %>                                            
                                            <td  class="everyCourse" id="course${elem.id}" planID="${elem.id}">
                                                ${elem.course}<br>${elem.teacher?'('+elem.teacher+')':'未添加'}
                                            </td>
                                        <%
                                            }
                                         %> 
                                          </tr>
                                    <%
                                        }
                                    %> 
                        </tbody>
                    </table>
                </div>
                <g:hiddenField name="courseAndTeacher"/>
                <g:hiddenField name="classesid" value="${classesid}"/>
                <div class="buttons">
                    <span class="button"><g:submitButton name="create" class="save" value="${message(code: 'default.button.create.label', default: 'Create')}" /><input type="button" value="上一步" onclick="javascript:history.go(-1)"></span>
                </div>
            </g:form>
            <div id="dialog-form" title="选择课程和老师">
            <div id="validName">
                    
             </div>
            <form>
            <fieldset>
                <label for="name">课程</label>
                <g:select name="course" from="${courselst}" optionKey="code" optionValue="code" class="text ui-widget-content ui-corner-all" noSelection="['':'-请选择-']"/>

                <label for="email">老师</label>
                <select name="teacher" id="teacher" class="text ui-widget-content ui-corner-all"></select>
                <g:each in="${teacherlst}" status="i" var="teacherCourseInstance">
                        <div style="display:none" id="${teacherCourseInstance?.key}">
                             <g:each in="${teacherCourseInstance?.value}" status="m" var="teacherInstance">
                                <option value="${teacherInstance?.id}">${teacherInstance?.name}</option>
                            </g:each>
                        </div>
                </g:each>
                <label for="password">您选择了</label>
            </fieldset>
            </form>
        </div>